package com.naiterui.ehp.bs.doctor.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author guoyongxiang
 * @date 2019-06-22 15:17
 * @since 1.0.0
 */
public class PasswordUtil {

    private static final BCryptPasswordEncoder PASSWORD_ENCODER = new BCryptPasswordEncoder();

    /**
     * 密码加密
     *
     * @param password 需要加密的密码
     *
     * @return 加密后的密码
     */
    public static String encode(String password) {
        return PASSWORD_ENCODER.encode(password);
    }

    public static boolean matches(String password, String encodedPasspword) {
        return PASSWORD_ENCODER.matches(password, encodedPasspword);
    }

}
